import request from '@/utils/request'

import { lifeServiceApi } from '../config'

const baseApi = '/diaries'

export function create(data) {
  return request({
    url: lifeServiceApi + baseApi,
    method: 'POST',
    data
  })
}

export function getPageList(params) {
  return request({
    url: lifeServiceApi + baseApi + '/page',
    method: 'GET',
    params
  })
}

export function getById(id) {
  return request({
    url: lifeServiceApi + baseApi + `/${id}`,
    method: 'GET'
  })
}

export function removeById(id) {
  return request({
    url: lifeServiceApi + baseApi + `/${id}`,
    method: 'DELETE'
  })
}

export function updateById(id, data) {
  return request({
    url: lifeServiceApi + baseApi + `/${id}`,
    method: 'PUT',
    data
  })
}
